import Types from '../action/types';

const initState = {
  num: 1,
};

export default (state = initState, action) => {
  switch (action.type) {
    case Types.COUNTER_INCREMENT:
      return {
        ...state,
        num: state.num + action.payload,
      };
    case Types.COUNTER_DECREMENT:
      return {
        ...state,
        num: state.num - action.payload,
      };
    default:
      return state;
  }
};
